load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")

oncall("fboss_agent_push")

cpp_library(
    name = "acl_test_utils",
    srcs = ["AclTestUtils.cpp"],
    headers = ["AclTestUtils.h"],
    exported_deps = [
        "//fboss/agent:asic_utils",
        "//fboss/agent:core",
        "//fboss/agent:fboss-error",
        "//fboss/agent:hw_switch",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent/hw/switch_asics:switch_asics",
        "//fboss/agent/state:state",
    ],
)

cpp_library(
    name = "copp_test_utils",
    srcs = ["CoppTestUtils.cpp"],
    headers = ["CoppTestUtils.h"],
    exported_deps = [
        "fbsource//third-party/googletest:gtest",
        ":acl_test_utils",
        ":load_balancer_test_utils",
        ":pkt_test_utils",
        "//fboss/agent:asic_utils",
        "//fboss/agent:core",
        "//fboss/agent:fboss-error",
        "//fboss/agent:fboss-types",
        "//fboss/agent:hw_switch",
        "//fboss/agent:packet",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent:voq_utils",
        "//fboss/agent/hw:hardware_stats-cpp2-types",
        "//fboss/agent/hw/switch_asics:switch_asics",
        "//fboss/agent/packet:packet",
        "//fboss/agent/packet:packet_factory",
        "//fboss/agent/state:state",
        "//fboss/agent/test:test_ensemble_if",
        "//fboss/lib:common_utils",
        "//folly:network_address",
        "//folly/logging:logging",
    ],
)

cpp_library(
    name = "udf_test_utils",
    srcs = ["UdfTestUtils.cpp"],
    headers = ["UdfTestUtils.h"],
    exported_deps = [
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent:utils",
    ],
)

cpp_library(
    name = "pkt_test_utils",
    srcs = [
        "PacketSendUtils.cpp",
        "PacketTestUtils.cpp",
    ],
    headers = [
        "PacketSendUtils.h",
        "PacketTestUtils.h",
    ],
    exported_deps = [
        "//fboss/agent:core",
        "//fboss/agent:fboss-types",
        "//fboss/agent:hw_switch",
        "//fboss/agent:packet",
        "//fboss/agent:tx_packet_utils",
        "//fboss/agent/hw:hardware_stats-cpp2-types",
        "//fboss/agent/packet:ipproto",
        "//fboss/agent/packet:packet",
        "//fboss/agent/packet:packet_factory",
        "//fboss/agent/state:state_utils",
        "//fboss/agent/test:test_ensemble_if",
        "//folly:network_address",
        "//folly/logging:logging",
    ],
)

cpp_library(
    name = "fabric_test_utils",
    srcs = ["FabricTestUtils.cpp"],
    headers = ["FabricTestUtils.h"],
    exported_deps = [
        "fbsource//third-party/googletest:gtest",
        "//fboss/agent:fboss-types",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent/hw/test:config_factory",
        "//fboss/agent/test:agent_ensemble",
        "//fboss/agent/test:test_ensemble_if",
        "//fboss/lib:common_utils",
    ],
)

cpp_library(
    name = "traffic_policy_utils",
    srcs = [
        "TrafficPolicyTestUtils.cpp",
    ],
    headers = ["TrafficPolicyTestUtils.h"],
    exported_deps = [
        ":acl_test_utils",
        ":copp_test_utils",
        "//fboss/agent:asic_utils",
        "//fboss/agent:hw_asic_table",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent/hw/switch_asics:switch_asics",
        "//fboss/agent/hw/test:config_factory",
        "//fboss/agent/packet:ipproto",
    ],
)

cpp_library(
    name = "olympic_qos_utils",
    srcs = [
        "OlympicTestUtils.cpp",
    ],
    headers = ["OlympicTestUtils.h"],
    exported_deps = [
        ":queue_test_utils",
        ":traffic_policy_utils",
        ":voq_test_utils",
        "//fboss/agent:agent_features",
        "//fboss/agent:asic_utils",
        "//fboss/agent:fboss-error",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent:utils",
        "//fboss/agent/hw/switch_asics:switch_asics",
    ],
)

cpp_library(
    name = "network_ai_qos_utils",
    srcs = [
        "NetworkAITestUtils.cpp",
    ],
    headers = ["NetworkAITestUtils.h"],
    exported_deps = [
        ":config_utils",
        ":queue_test_utils",
        ":traffic_policy_utils",
        ":voq_test_utils",
        "//fboss/agent:agent_features",
        "//fboss/agent:asic_utils",
        "//fboss/agent:platform_config-cpp2-types",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent/hw/switch_asics:switch_asics",
    ],
)

cpp_library(
    name = "port_test_utils",
    srcs = [
        "PortTestUtils.cpp",
    ],
    headers = ["PortTestUtils.h"],
    exported_deps = [
        "//fboss/agent:fboss-error",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent/state:state",
        "//fboss/agent/test:test_ensemble_if",
        "//fboss/qsfp_service/if:transceiver-cpp2-types",
    ],
)

cpp_library(
    name = "trunk_test_utils",
    srcs = [
        "TrunkTestUtils.cpp",
    ],
    headers = ["TrunkTestUtils.h"],
    exported_deps = [
        "//fboss/agent:fboss-types",
        "//fboss/agent/if:agent_hw_test_ctrl-cpp2-services",
        "//fboss/agent/state:state",
        "//fboss/agent/test:agent_ensemble",
    ],
)

cpp_library(
    name = "mac_test_utils",
    srcs = [
        "MacTestUtils.cpp",
    ],
    headers = ["MacTestUtils.h"],
    exported_deps = [
        "//fboss/agent:core",
        "//fboss/agent/if:ctrl-cpp2-types",
        "//fboss/agent/state:state",
        "//fboss/agent/test:test_ensemble_if",
        "//folly:network_address",
    ],
)

cpp_library(
    name = "config_utils",
    srcs = [
        "ConfigUtils.cpp",
    ],
    headers = ["ConfigUtils.h"],
    exported_deps = [
        ":acl_test_utils",
        ":port_test_utils",
        ":voq_test_utils",
        "//fboss/agent:agent_features",
        "//fboss/agent:asic_utils",
        "//fboss/agent:core",
        "//fboss/agent:fboss-error",
        "//fboss/agent:fboss-types",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent/hw/switch_asics:switch_asics",
        "//fboss/agent/platforms/common:platform_mapping",
        "//fboss/agent/state:state",
        "//fboss/agent/test:test_ensemble_if",
        "//fboss/lib/config:fboss_config_utils",
        "//folly:format",
        "//folly:network_address",
        "//folly/testing:test_util",
    ],
)

cpp_library(
    name = "asic_test_utils",
    srcs = [
        "AsicUtils.cpp",
    ],
    headers = ["AsicUtils.h"],
    exported_deps = [
        "//fboss/agent:core",
        "//fboss/agent:fboss-types",
        "//fboss/agent/hw/switch_asics:switch_asics",
    ],
)

cpp_library(
    name = "qos_test_utils",
    srcs = [
        "QosTestUtils.cpp",
    ],
    headers = [
        "QosTestUtils.h",
    ],
    exported_deps = [
        "fbsource//third-party/googletest:gtest",
        ":pkt_test_utils",
        ":voq_test_utils",
        "//fboss/agent:asic_utils",
        "//fboss/agent:core",
        "//fboss/agent:fboss-types",
        "//fboss/agent:hw_asic_table",
        "//fboss/agent:utils",
        "//fboss/agent/hw/switch_asics:switch_asics",
        "//fboss/agent/state:state",
        "//fboss/agent/test:ecmp_helper",
        "//fboss/agent/test:resourcelibutil",
        "//fboss/agent/test:test_ensemble_if",
        "//fboss/lib:common_utils",
        "//folly:network_address",
    ],
)

cpp_library(
    name = "load_balancer_test_utils",
    srcs = [
        "LoadBalancerTestUtils.cpp",
    ],
    exported_deps = [
        "fbsource//third-party/googletest:gtest",
        ":acl_test_utils",
        ":config_utils",
        ":voq_test_utils",
        "//fboss/agent:agent_features",
        "//fboss/agent:asic_utils",
        "//fboss/agent:core",
        "//fboss/agent:loadbalancer_utils",
        "//fboss/agent:packet",
        "//fboss/agent:switchid_scope_resolver",
        "//fboss/agent:utils",
        "//fboss/agent/hw/switch_asics:switch_asics",
        "//fboss/agent/packet:packet_factory",
        "//fboss/agent/state:state",
        "//fboss/agent/test:resourcelibutil",
        "//fboss/agent/test:test_ensemble_if",
        "//fboss/lib:common_utils",
        "//folly/gen:base",
    ],
)

cpp_library(
    name = "dscp_marking_utils",
    srcs = [
        "DscpMarkingUtils.cpp",
    ],
    headers = ["DscpMarkingUtils.h"],
    undefined_symbols = True,
    exported_deps = [
        ":acl_test_utils",
        ":config_utils",
        ":olympic_qos_utils",
        ":traffic_policy_utils",
        "//fboss/agent:asic_utils",
        "//fboss/agent:fboss-types",
        "//fboss/agent:hw_asic_table",
        "//fboss/agent:switch_config-cpp2-types",
    ],
)

cpp_library(
    name = "trap_packet_utils",
    srcs = [
        "TrapPacketUtils.cpp",
    ],
    exported_deps = [
        ":acl_test_utils",
        "//fboss/agent:fboss-types",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent/hw/switch_asics:switch_asics",
        "//folly:network_address",
    ],
)

cpp_library(
    name = "stats_test_utils",
    srcs = [
        "StatsTestUtils.cpp",
    ],
    headers = ["StatsTestUtils.h"],
    exported_deps = [
        "//fboss/agent:stat_printers",
        "//fboss/agent/if:multiswitch_ctrl-cpp2-types",
    ],
)

cpp_library(
    name = "queue_per_host_test_utils",
    srcs = [
        "QueuePerHostTestUtils.cpp",
    ],
    headers = ["QueuePerHostTestUtils.h"],
    exported_deps = [
        ":acl_test_utils",
        ":config_utils",
        ":copp_test_utils",
        ":load_balancer_test_utils",
        ":traffic_policy_utils",
        "//fboss/agent:fboss-types",
        "//fboss/agent:hw_switch",
        "//fboss/agent:packet",
        "//fboss/agent:route_update_wrapper",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent/hw:hardware_stats-cpp2-types",
        "//fboss/agent/hw/test:config_factory",
        "//fboss/agent/packet:packet_factory",
        "//fboss/agent/state:state",
        "//fboss/agent/test:agent_ensemble",
        "//fboss/lib:common_utils",
        "//folly:network_address",
    ],
)

cpp_library(
    name = "ecmp_dataplane_test_util",
    srcs = [
        "EcmpDataPlaneTestUtil.cpp",
    ],
    exported_deps = [
        ":load_balancer_test_utils",
        "//fboss/agent:fboss-types",
        "//fboss/agent:route_update_wrapper",
        "//fboss/agent/packet:packet",
        "//fboss/agent/state:state",
        "//fboss/agent/test:ecmp_helper",
        "//fboss/agent/test:linkstate_toggler",
        "//fboss/agent/test:test_ensemble_if",
    ],
)

cpp_library(
    name = "port_stats_test_utils",
    srcs = [
        "PortStatsTestUtils.cpp",
    ],
    exported_deps = [
        "//fboss/agent:fboss-types",
        "//fboss/agent:stats",
        "//fboss/agent/hw:hardware_stats-cpp2-types",
        "//folly/logging:logging",
        "//thrift/lib/cpp2/protocol:protocol",
    ],
)

cpp_library(
    name = "packet_snooper",
    srcs = ["PacketSnooper.cpp"],
    headers = ["PacketSnooper.h"],
    exported_deps = [
        "fbsource//third-party/googletest:gtest",
        ":pkt_test_utils",
        "//fboss/agent:core",
        "//fboss/agent:fboss-types",
        "//fboss/agent:packet",
        "//fboss/agent:packet_observer",
        "//fboss/agent/packet:packet_factory",
        "//folly:optional",
        "//folly/io:iobuf",
    ],
)

cpp_library(
    name = "aqm_test_utils",
    srcs = [
        "AqmTestUtils.cpp",
    ],
    headers = ["AqmTestUtils.h"],
    exported_deps = [
        "fbsource//third-party/googletest:gtest",
        ":port_test_utils",
        "//fboss/agent:fboss-error",
        "//fboss/agent:fboss-types",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent/hw:hardware_stats-cpp2-types",
        "//fboss/agent/hw/switch_asics:switch_asics",
        "//fboss/agent/if:agent_hw_test_ctrl-cpp2-clients",
        "//fboss/agent/if:agent_hw_test_ctrl-cpp2-services",
        "//fboss/agent/test:test_ensemble_if",
        "//fboss/lib:common_utils",
    ],
)

cpp_library(
    name = "load_balancer_test_runner_h",
    headers = [
        "LoadBalancerTestRunner.h",
    ],
    exported_deps = [
        "fbsource//third-party/googletest:gtest",
        ":config_utils",
        ":ecmp_dataplane_test_util",
        ":load_balancer_test_utils",
        ":udf_test_utils",
    ],
    exported_external_deps = [
        ("boost", None, "boost_preprocessor"),
    ],
)

cpp_library(
    name = "agent_hw_test_constants",
    srcs = [
        "AgentHwTestConstants.cpp",
    ],
    exported_deps = [
        "//fboss/agent/if:mpls-cpp2-types",
    ],
)

cpp_library(
    name = "scale_test_utils",
    srcs = [
        "ScaleTestUtils.cpp",
    ],
    headers = ["ScaleTestUtils.h"],
    exported_deps = [
        "fbsource//third-party/googletest:gtest",
        "//fboss/agent:asic_utils",
        "//fboss/agent:core",
        "//fboss/agent:fboss-types",
        "//fboss/agent/hw/switch_asics:switch_asics",
    ],
)

cpp_library(
    name = "agent_fsdb_integ_bench_helper",
    srcs = ["AgentFsdbIntegrationBenchmarkHelper.cpp"],
    headers = ["AgentFsdbIntegrationBenchmarkHelper.h"],
    exported_deps = [
        "//fboss/agent:agent_fsdb_sync_manager",
        "//fboss/agent/benchmarks:agent_benchmarks_h",  # @manual
        "//fboss/agent/test:agent_ensemble",
        "//fboss/fsdb/client:fsdb_pub_sub",
        "//fboss/fsdb/common:flags",
        "//fboss/lib:common_file_utils",
        "//folly:benchmark",
        "//folly/synchronization:baton",
        "//servicerouter/client/cpp2:cpp2",
    ],
    exported_external_deps = [
        "gflags",
    ],
)

cpp_library(
    name = "invariant_test_utils",
    srcs = [
        "InvariantTestUtils.cpp",
    ],
    exported_deps = [
        ":config_utils",
        ":copp_test_utils",
        ":load_balancer_test_utils",
        ":qos_test_utils",
        "//fboss/agent:packet",
        "//fboss/agent:validated_shell_commands-cpp2-types",
        "//fboss/agent/packet:packet_factory",
        "//fboss/agent/test:test_ensemble_if",
    ],
)

cpp_library(
    name = "route_test_utils",
    srcs = [
        "RouteTestUtils.cpp",
    ],
    exported_deps = [
        "//fboss/agent:route_update_wrapper",
        "//fboss/agent/if:agent_hw_test_ctrl-cpp2-types",
        "//fboss/agent/if:ctrl-cpp2-types",
        "//fboss/agent/test:agent_ensemble",
        "//fboss/agent/test:route_distribution_gen",
    ],
)

cpp_library(
    name = "mirror_test_utils",
    srcs = [
        "MirrorTestUtils.cpp",
    ],
    exported_deps = [
        ":config_utils",
        ":trap_packet_utils",
        "//fboss/agent:fboss-types",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent/test:agent_ensemble",
        "//folly:network_address",
    ],
)

cpp_library(
    name = "pfc_test_utils",
    srcs = [
        "PfcTestUtils.cpp",
    ],
    headers = [
        "PfcTestUtils.h",
    ],
    exported_deps = [
        ":acl_test_utils",
        "//fboss/agent:asic_utils",
        "//fboss/agent:fboss-types",
        "//fboss/agent:packet",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent/hw:hardware_stats-cpp2-types",
        "//fboss/agent/packet:packet_factory",
        "//fboss/agent/test:agent_ensemble",
        "//fboss/agent/test:resourcelibutil",
        "//fboss/agent/test:test_ensemble_if",
        "//folly:network_address",
    ],
)

cpp_library(
    name = "queue_test_utils",
    srcs = [
        "QueueTestUtils.cpp",
    ],
    headers = [
        "QueueTestUtils.h",
    ],
    exported_deps = [
        "//fboss/agent:agent_features",
        "//fboss/agent:fboss-types",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent/hw/switch_asics:switch_asics",
    ],
)

cpp_library(
    name = "l2learn_observer_util",
    srcs = [
        "L2LearningUpdateObserverUtil.cpp",
    ],
    headers = [
        "L2LearningUpdateObserverUtil.h",
    ],
    exported_deps = [
        "//fboss/agent:core",
        "//fboss/agent:hwswitchcallback",
        "//fboss/agent:l2learn_event_observer",
        "//fboss/agent/test:agent_ensemble",
        "//folly:optional",
    ],
)

cpp_library(
    name = "voq_test_utils",
    srcs = [
        "VoqTestUtils.cpp",
    ],
    headers = [
        "VoqTestUtils.h",
    ],
    exported_deps = [
        "//fboss/agent:agent_features",
        "//fboss/agent:core",
        "//fboss/agent:fboss-types",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent:switchid_scope_resolver",
        "//fboss/agent:voq_utils",
        "//fboss/agent/hw/switch_asics:switch_asics",
        "//fboss/agent/platforms/common/meru800bia:meru800bia_platform_mapping",
        "//fboss/agent/state:state",
        "//fboss/agent/test:ecmp_helper",
        "//fboss/agent/test:test_ensemble_if",
    ],
)

cpp_library(
    name = "ecmp_resource_mgr_test_utils",
    srcs = [
        "EcmpResourceManagerTestUtils.cpp",
    ],
    headers = [
        "EcmpResourceManagerTestUtils.h",
    ],
    exported_deps = [
        "fbsource//third-party/googletest:gtest",
        "//fboss/agent:agent_features",
        "//fboss/agent:ecmp_resource_manager",
        "//fboss/agent:fib_helpers",
        "//fboss/agent:utils",
        "//fboss/agent/state:state",
        "//fboss/agent/test:utils",
    ],
)

cpp_library(
    name = "dsf_config_utils",
    srcs = [
        "DsfConfigUtils.cpp",
    ],
    headers = [
        "DsfConfigUtils.h",
    ],
    exported_deps = [
        ":config_utils",
        "//fboss/agent:agent_features",
        "//fboss/agent:asic_utils",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent:voq_utils",
        "//fboss/agent/hw/switch_asics:switch_asics",
    ],
)

cpp_library(
    name = "multi_port_traffic_test_utils",
    srcs = [
        "MultiPortTrafficTestUtils.cpp",
    ],
    headers = [
        "MultiPortTrafficTestUtils.h",
    ],
    exported_deps = [
        ":qos_test_utils",
        "//fboss/agent:utils",
        "//fboss/agent/state:state_utils",
        "//fboss/agent/test:agent_hw_test",
        "//fboss/agent/test:ecmp_helper",
    ],
)

cpp_library(
    name = "port_flap_helper",
    srcs = [
        "PortFlapHelper.cpp",
    ],
    headers = [
        "PortFlapHelper.h",
    ],
    exported_deps = [
        "//fboss/agent/test:agent_ensemble",
    ],
)

cpp_library(
    name = "system_scale_test_utils",
    srcs = [
        "SystemScaleTestUtils.cpp",
    ],
    headers = [
        "SystemScaleTestUtils.h",
    ],
    exported_deps = [
        ":acl_scale_test_utils",
        ":acl_test_utils",
        ":copp_test_utils",
        ":mac_learning_flood_helper",
        ":port_flap_helper",
        ":qos_test_utils",
        ":scale_test_utils",
        ":trap_packet_utils",
        "//fboss/agent:agent_features",
        "//fboss/agent:asic_utils",
        "//fboss/agent:handler",
        "//fboss/agent:packet",
        "//fboss/agent/benchmarks:agent_benchmarks_h",  # @manual
        "//fboss/agent/hw/test:config_factory",
        "//fboss/agent/packet:packet_factory",
        "//fboss/agent/test:agent_ensemble",
        "//fboss/agent/test:ecmp_helper",
        "//fboss/agent/test:route_scale_gen",
        "//fboss/lib:function_call_time_reporter",
        "//folly:benchmark",
    ],
)

cpp_library(
    name = "acl_scale_test_utils",
    srcs = [
        "AclScaleTestUtils.cpp",
    ],
    headers = [
        "AclScaleTestUtils.h",
    ],
    exported_deps = [
        ":acl_test_utils",
        "//fboss/agent:asic_utils",
        "//fboss/agent/hw/switch_asics:switch_asics",
    ],
)

cpp_library(
    name = "stress_test_utils",
    srcs = [
        "StressTestUtils.cpp",
    ],
    headers = [
        "StressTestUtils.h",
    ],
    exported_deps = [
        ":acl_test_utils",
        ":copp_test_utils",
        ":trap_packet_utils",
        "//fboss/agent:asic_utils",
        "//fboss/agent:core",
        "//fboss/agent/benchmarks:agent_benchmarks_h",  # @manual
        "//fboss/agent/hw/test:config_factory",
        "//fboss/agent/test:agent_ensemble",
        "//fboss/agent/test:route_scale_gen",
        "//fboss/lib:function_call_time_reporter",
        "//folly:benchmark",
    ],
)

cpp_library(
    name = "ecmp_test_utils",
    srcs = [
        "EcmpTestUtils.cpp",
    ],
    headers = ["EcmpTestUtils.h"],
    exported_deps = [
        "//fboss/agent/test:agent_ensemble",
    ],
)

cpp_library(
    name = "mac_learning_flood_helper",
    srcs = [
        "MacLearningFloodHelper.cpp",
    ],
    headers = [
        "MacLearningFloodHelper.h",
    ],
    exported_deps = [
        ":qos_test_utils",
        "//fboss/agent:packet",
        "//fboss/agent/packet:packet_factory",
        "//fboss/agent/test:agent_ensemble",
        "//fboss/agent/test:ecmp_helper",
    ],
)

cpp_library(
    name = "neighbor_test_utils",
    headers = ["NeighborTestUtils.h"],
    exported_deps = [
        "//fboss/agent:core",
        "//fboss/agent/state:state",
    ],
)
